/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.zx.common.material.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.TreeService;
import com.jeesite.modules.zx.common.material.entity.TcommonMaterial;
import com.jeesite.modules.zx.common.material.dao.TcommonMaterialDao;
import com.jeesite.modules.file.utils.FileUploadUtils;

/**
 * 公共资料Service
 * @author zpp
 * @version 2020-02-14
 */
@Service
@Transactional(readOnly=true)
public class TcommonMaterialService extends TreeService<TcommonMaterialDao, TcommonMaterial> {
	
	/**
	 * 获取单条数据
	 * @param tcommonMaterial
	 * @return
	 */
	@Override
	public TcommonMaterial get(TcommonMaterial tcommonMaterial) {
		return super.get(tcommonMaterial);
	}
	
	/**
	 * 查询列表数据
	 * @param tcommonMaterial
	 * @return
	 */
	@Override
	public List<TcommonMaterial> findList(TcommonMaterial tcommonMaterial) {
		return super.findList(tcommonMaterial);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param tcommonMaterial
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(TcommonMaterial tcommonMaterial) {
		super.save(tcommonMaterial);
		// 保存上传图片
		FileUploadUtils.saveFileUpload(tcommonMaterial.getId(), "tcommonMaterial_image");
		// 保存上传附件
		FileUploadUtils.saveFileUpload(tcommonMaterial.getId(), "tcommonMaterial_file");
	}
	
	/**
	 * 更新状态
	 * @param tcommonMaterial
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(TcommonMaterial tcommonMaterial) {
		super.updateStatus(tcommonMaterial);
	}
	
	/**
	 * 删除数据
	 * @param tcommonMaterial
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(TcommonMaterial tcommonMaterial) {
		super.delete(tcommonMaterial);
	}
	
}